﻿#ifndef BASEREQUESTER_H
#define BASEREQUESTER_H
#include <QObject>
#include <QMutex>
#include <QTimer>
#include <QDebug>
#pragma execution_character_set("utf-8")

class BaseRequester : public QObject
{
    Q_OBJECT
public:
    Q_INVOKABLE explicit BaseRequester(QObject *parent = nullptr);

public:
    virtual bool request(QByteArray data,QByteArray &rec);

    virtual bool requestNoReply(QByteArray data);

    void setKeepLiveData(QByteArray arr, int intervalMs);
    void startKeepLive();
    void stopKeepLive();

private slots:
    void keepLive();

public slots:

protected:
    QMutex _mutex;
    QTimer *_timer = nullptr;
    QByteArray _keepLiveData;
};

#endif // BASEREQUESTER_H
